package com.news.collect.common;

import java.util.HashMap;

public class CommonResult extends HashMap<String, Object> {
    private static final String Ret = "ret";
    private static final String Msg = "msg";
    private static final String Data = "data";

    public CommonResult() {

    }

    public CommonResult(int ret, String msg) {
        super.put(Ret, ret);
        super.put(Msg, msg);
    }

    public CommonResult(int ret, String msg, Object data) {
        super.put(Ret, ret);
        super.put(Msg, msg);
        super.put(Data, data);
    }

    public static CommonResult success(String msg, Object data) {
        return new CommonResult(1, msg, data);
    }

    public static CommonResult success(Object data) {
        return success("操作成功", data);
    }

    public static CommonResult success() {
        return success(null);
    }

    public static CommonResult success(String msg) {
        return new CommonResult(1, msg, null);
    }
}
